package nsqcli

import (
	"github.com/nsqio/go-nsq"
	//"github.com/astaxie/beego"
)

func StartProducer(address, topic string, msg []byte) error {
	cfg := nsq.NewConfig()
	producer, err := nsq.NewProducer(address, cfg)
	if err != nil {
		return err
	}
	if err := producer.Publish(topic, msg); err != nil {
		return err
	}
	if producer != nil {
		producer.Stop()
	}
	return nil
}

